class A:
    def __enter__(self):
        print('enter')
        return self

    def __exit__(self, exc_type, exc_val, exc_tb):
        print('exit')

    def show(self):
        print('show')


with A() as a:
    a.show()